<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="HeimaRiches/lib/underscore/underscore-min.js"></script>
    <link rel="stylesheet" href="HeimaRiches/lib/bootstrap/bootstrap-3.3.7/css/bootstrap.min.css">
    <script type="text/template" id="template">
        <%_.each(items,function(item){%>
        <p>姓名:<%=item.name%>,年龄:<%=item.age%></p>
        <%})%>

    </script>
    <script>
        var items=[
            {name:"kobe",age:"36"},
            {name:"james",age:"36"},
            {name:"Mamba",age:"36"},
            {name:"kobe",age:"36"},
        ];

        window.onload=function () {
            var tpl=document.getElementById("template");
            var bodyEle=document.getElementsByTagName("body")[0]
            var template =_.template(tpl.innerHTML,items);
            console.log("--------->"+template)
            $("body").append(template)

            var temp=_.template(tpl,innerHTML,items)
            var html=temp();

        }
    </script>
</head>
<body>


<script src="HeimaRiches/lib/jquery/jquery.js"></script>
<script src="HeimaRiches/lib/bootstrap/bootstrap-3.3.7/js/bootstrap.min.js"></script>
</body>
</html>